<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <!--    <h:body>-->
    <ui:composition template="layout.xhtml">-->

        <ui:define name="corpo">
            <h:form id="index_form" acceptcharset="utf-8"> 
                <p:panel header="Principal - Serviço Selo">
                    <p:commandLink  value="Gerar Serviços" actionListener="#{managerServicoSelo.gerarServico()}" update="@form, servTable" rendered="#{empty managerServicoSelo.listarServico() ? true : false}" process="@form" />
                    <br/>
                    <h:panelGrid style="float: right;" columns="4">
                        <p:graphicImage url="/media/img/new.png" title="Cadastrar Serviço Selo" /> <p:commandLink   value="Cadastrar" title="Cadastrar Serviço" actionListener="#{managerServicoSelo.criarServicoSelo()}" update="@form"/>
                        <p:graphicImage url="/media/img/search.png" title="Pesquisar Serviço Selo"/><p:commandLink value="Pesquisar" title="Pesquisar Serviço" actionListener="#{managerServicoSelo.pesquisarServicoSelo()}" update="@form"/>
                    </h:panelGrid>
                    <br/>
                    <br/>
                    <p:dataTable id="servTable" var="serv" value="#{managerServicoSelo.listarServico()}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="5,10,15">    

                        <f:facet name="header">  
                            Todos Serviços Cadastrados
                        </f:facet>
                            
                        <p:column filterBy="#{serv.descricao}" style="width:400px;">  
                            <f:facet name="header" >   
                                Descrição
                            </f:facet>  
                            <h:outputText value="#{serv.descricao}" />  
                        </p:column>
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Cartório
                            </f:facet>  
                            <h:outputText value="#{serv.cartorio}"
                                           />  
                        </p:column>
                        <p:column style="width:100px;">  
                            <f:facet name="header" >   
                                FermoJupi
                            </f:facet>  
                            <h:outputText value="#{serv.fermoJupi}"
                                           /> 
                        </p:column>
                        <p:column style="width:100px;">  
                            <f:facet name="header" >   
                               OAB
                            </f:facet>  
                            <h:outputText value="#{serv.OAB}"
                                           /> 
                        </p:column>
                         
                        <p:column style="width:80px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar" actionListener="#{managerServicoSelo.editarServico(serv)}" update="@form"/> 
                            <p:commandButton  icon="view" actionListener="#{managerServicoSelo.visualizarServicoSelo(serv)}" update="@form"/>   

                        </p:column>
                        
                    </p:dataTable> 

                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
